const user = {
        state: {
            userInfo: JSON.parse(localStorage.getItem("userInfo")),

        },
        actions: {
            // 登录
            Login({
                commit
            }, userInfo) {
                const username = userInfo.username.trim()
                return new Promise((resolve, reject) => {
                    console.log("进入");
                    login(username, userInfo.password).then(response => {
                        console.log(response.data);
                        const data = response.data
                        const tokenStr = data.tokenHead + data.token
                        const userInfo = data.user;
                        // setToken(tokenStr)
                        // commit('SET_TOKEN', tokenStr)
                        // commit('SET_USERINFO', userInfo)
                        resolve()
                    }).catch(error => {
                        reject(error)
                    })
                })
            },

        }